/*
 * ComputeHeightLines.h
 *
 *  Created on: 8 Nov 2013
 *      Author: Patrick
 */

#ifndef COMPUTEHEIGHTLINES_H_
#define COMPUTEHEIGHTLINES_H_

#include <engine/datatypes/MapObject.h>
#include <engine/datatypes/HermiteSurface.h>

namespace Engine {

class ComputeHeightLines {
public:

	static std::vector<MapObject*> computeHeightlines(
		HermiteSurface* surface,
		float minHeight,
		float maxHeight,
		float deltaHeight);

private:
	enum StepDirection {
		None, Up, Right, Down, Left
	};

	enum Interpolations {
		UpleftUpright, UprightUpleft,
		UpleftDownleft, DownleftUpleft,
		DownrightDownleft, DownleftDownright,
		DownrightUpright, UprightDownright
	};

	static bool interpolate(
		Ogre::Vector2 currentPoint,
		float height,
		HermiteSurface* surface,
		Interpolations type,
		Ogre::Vector3 &point);

	static Ogre::Vector2 findStartingPoint(
			std::vector<std::vector<int> >* regions,
			int currentRegion);
};

} /* namespace Engine */

#endif /* COMPUTEHEIGHTLINES_H_ */
